<?xml version="1.0" encoding="UTF-8" ?>
<!--
 *************************************************************************
 * The contents of this file are subject to the Openbravo  Public  License
 * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
 * Version 1.1  with a permitted attribution clause; you may not  use this
 * file except in compliance with the License. You  may  obtain  a copy of
 * the License at http://www.openbravo.com/legal/license.html
 * Software distributed under the License  is  distributed  on  an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific  language  governing  rights  and  limitations
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
 * All portions are Copyright (C) 2010-2011 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s): Enterprise Intelligence Systems (http://www.eintel.com.au).
 *************************************************************************
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title id="paramTitle">xxTitle</title>
<link rel="shortcut icon" href="../../../../../web/images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="../../../../../web/skins/Default/Openbravo_ERP_250.css" id="paramCSS"></link>

<script language="JavaScript" type="text/javascript" id="paramDirectory">
  var baseDirectory = "../../../../../web/";
</script>
<script language="JavaScript" src="../../../../../web/js/messages.js" type="text/javascript"></script>
<script language="JavaScript" src="../utility/DynamicJS.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript" id="paramLanguage">
  var defaultLang = "en_US";
</script>
<script language="JavaScript" src="../../../../../web/js/shortcuts.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/utils.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/windowKeyboard.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/searchs.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/ajax.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/default/MessageBox.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/messages.js" type="text/javascript"></script>
<script language="JavaScript" src="../utility/DynamicJS.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/calculator.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/jscalendar/calendar.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/jscalendar/lang/calendar-es.js" type="text/javascript" id="fieldCalendar"></script>
<script language="JavaScript" src="../../../../../web/js/default/DateTextBox.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/org.openbravo.advpaymentmngt/FIN_Utilities.js" type="text/javascript"></script>
<script type="text/javascript">
  window.onunload = reloadOpener; // reloads opener on closing
</script>

<script language="JavaScript" type="text/javascript">
function validate(action) {
  var frm = document.frmMain;
  if (action=='openprocess') {
    if (frm.inpDocNumber.value==null || frm.inpDocNumber.value=="") {
      setWindowElementFocus(frm.inpDocNumber);
      showJSMessage(7);
      return false;
    } else if (frm.inpPaymentMethod.value==null || frm.inpPaymentMethod.value=="") {
      setWindowElementFocus(frm.inpPaymentMethod);
      showJSMessage(7);
      return false;
    } else if (frm.inpFinancialAccount.value==null || frm.inpFinancialAccount.value=="") {
      setWindowElementFocus(frm.inpFinancialAccount);
      showJSMessage(7);
      return false;
    } else if (frm.inpCurrencyId.value==null || frm.inpCurrencyId.value=="") {
      setWindowElementFocus(frm.inpCurrencyId);
      showJSMessage(7);
      return false;
    } else if (frm.inpExpectedPayment.value==null || frm.inpExpectedPayment.value=="") {
      setWindowElementFocus(frm.inpExpectedPayment);
      showJSMessage(7);
      return false;
    } else if (frm.inpActualPayment.value==null || frm.inpActualPayment.value=="") {
      setWindowElementFocus(frm.inpActualPayment);
      showJSMessage(7);
      return false;
    } else if (frm.inpPaymentDate.value==null || frm.inpPaymentDate.value=="") {
      setWindowElementFocus(frm.inpPaymentDate);
      showJSMessage(7);
      return false;
    } else if (isMulticurrencyTxn()) {
      if (frm.inpActualConverted.value==null || frm.inpActualConverted.value=="") {
        setWindowElementFocus(frm.inpActualConverted);
        showJSMessage(7);
        return false;
      } else if (frm.inpExchangeRate.value==null || frm.inpExchangeRate.value=="") {
        setWindowElementFocus(frm.inpExchangeRate);
        showJSMessage(7);
        return false;
      }
    } else {
      var diffAction = frm.inpDifferenceAction,
          i,
          selectedAction = null,
          actionSelected = false;
      for (i = 0; i < diffAction.length; i++) {
        if (diffAction[i].checked) {
          actionSelected = true;
          break;
        }
      }
      if (actionSelected) {
        selectedAction = diffAction[i].value;
      }
      if (!validateSelectedPendingPayments(false, selectedAction)) return false;
    }
  }
  return true;
}
</script>
<script language="JavaScript" type="text/javascript">
function closeThisPage() {
    closePage();
    return true;
}
function submitThisPage(strCommand) {
  if (validate(strCommand)) {
    submitCommandForm(strCommand, false, null, null);
    return true;
  }
  return true;
}
function openProcessPayment() {
  if (validate('openprocess')) {
    var amount = document.frmMain.inpActualPayment.value;
    // if amount is 0 deposit or withdrawn is not allowed
    // skip action regarding document window
    if ( compare(amount, '==', 0) ) {
      submitThisPage('SAVEANDPROCESS');
      return true;
    }
    document.getElementById('client_top_popup').style.display = 'block';
    document.getElementById('client_top').style.display = 'none';
    document.getElementById('client_middle').style.display = 'none';
    document.getElementById('client_bottom').style.display = 'none';
  }
}
function closeProcessPayment() {
  document.getElementById('client_top_popup').style.display = 'none';
  document.getElementById('client_top').style.display = 'block';
  document.getElementById('client_middle').style.display = 'block';
  document.getElementById('client_bottom').style.display = 'block';
}

function updateData(key, mark, drivenByGrid) {
  if (mark==null) mark=false;
  updateReadOnly(key, mark);
  var paymentAmount = document.frmMain.elements['inpPaymentAmount'+key];
  if (!isTrue('isReceipt')){
    if (mark && paymentAmount.value=='') {
      paymentAmount.value = document.frmMain.elements['inpRecordAmt'+key].value;
    }
  } else { // sales
    if (drivenByGrid && mark && !paymentAmount.value) {
      var total = document.getElementById('inpTotal').value ? document.getElementById('inpTotal').value : 0;
      var actualPayment = document.getElementById('paramActualPayment').value;
      if (frm.inpUseCredit.checked) {
        actualPayment = add(actualPayment, document.frmMain.inpCredit.value);
      }
      var gridAmt = document.frmMain.elements['inpRecordAmt'+key].value;

      if ( compare(actualPayment, '<', 0) && compare(gridAmt, '>=', 0) ) {
        paymentAmount.value = 0;
      } else {
        if ( compare(actualPayment, '<', 0) && compare(gridAmt, '<', 0) ) {
          total = abs(total);
          actualPayment = abs(actualPayment);
          subtotal = add(total, abs(gridAmt));
          if ( compare(subtotal, '>', actualPayment)) {
            paymentAmount.value = subtract(0, subtract(actualPayment, total));
          } else {
            paymentAmount.value = gridAmt;
          }
        } else {
          var subtotal = add(total, gridAmt);
          if ( compare(subtotal, '>', actualPayment)) {
            paymentAmount.value = subtract(actualPayment, total);
          } else {
            paymentAmount.value = gridAmt;
          }
        }
      }
    }
  }
  updateTotal();

  return true;
}

function validateDate(element){
  if(isValidDate(element.value, element.getAttribute("displayformat")))
    loadGridList();
}

function paymentAmountOnChange(element){
  updateTotal();
  numberInputEvent('onchange', element);
}

function paymentDateOnChange(){
  try {
    var url = "../org.openbravo.advpaymentmngt.ad_actionbutton/AddPaymentFromInvoice.html";
    var paramXMLReq = null;
    return submitXmlHttpRequest(callBackExchangeRate, document.frmMain, "EXCHANGERATE", url, false, null, paramXMLReq);
  } catch (e) {
    alert(e);
  }
}

function callBackExchangeRate(paramXMLParticular, XMLHttpRequestObj) {
  if (getReadyStateHandler(XMLHttpRequestObj)) {
    try {
      if (XMLHttpRequestObj.responseText) {
        var resp = decodeJSON(XMLHttpRequestObj.responseText);
        document.getElementById('paramExchangeRate').value=resp.exchangeRate;
      } else {
        document.getElementById('paramExchangeRate').value='';
      }
      updateConvertedAmounts();
      displayMulticurrencyControls();
    } catch (e) {
    }
  }
  return true;
}

function useCreditOnChange(){
  actualPaymentOnChange();
  updateTotal();
}

function actualPaymentOnChange(){
  if (isTrue('isReceipt')) {
    var amount = document.frmMain.inpActualPayment.value;
    if (document.frmMain.inpUseCredit.checked)
      amount = add(amount, document.frmMain.inpCredit.value);
    distributeAmount(amount);
  }
}

function isMulticurrencyTxn() {
  var invCurrency = document.getElementById('paramCurrencyId').value
  var accountCurrency = document.getElementById('paramFinancialAccountCurrencyId').value
  return invCurrency && accountCurrency && invCurrency != accountCurrency;
}

function displayMulticurrencyControls() {
  var display = isMulticurrencyTxn();  displayLogicElement('paramExchangeRate', display );
  displayLogicElement('lblExchangeRate', display );
  displayLogicElement('paramExpectedConverted', display );
  displayLogicElement('lblExpectedConverted', display );
  displayLogicElement('paramActualConvertedCell', display );
  displayLogicElement('lblActualConverted', display );
}


</script>
<script language="JavaScript" type="text/javascript">
function loadGridList() {
  try {
    var url = "../org.openbravo.advpaymentmngt.ad_actionbutton/AddPaymentFromInvoice.html";
    var paramXMLReq = null;
    return submitXmlHttpRequest(callBackGrid, document.frmMain, "GRIDLIST", url, false, null, paramXMLReq);
  } catch (e) {
    alert(e);
  }
}

function callBackGrid(paramXMLParticular, XMLHttpRequestObj) {
  var strText = "";
  if (getReadyStateHandler(XMLHttpRequestObj)) {
    try {
      if (XMLHttpRequestObj.responseText) {
        strText = XMLHttpRequestObj.responseText;
        var aux = strText.substring(29, strText.length-8);
        var tableBody = document.getElementById('sectionGrid');
        var browserName = getBrowserInfo('name');
        if (browserName.toUpperCase().indexOf('INTERNET EXPLORER') != -1) {
          var temp = document.createElement("span");
          temp.id = 'temp';
          temp.style.display = 'none';
          var newRows = '<table><tbody id=\"sectionGrid\">'+ aux;
          temp.innerHTML = newRows;
          tableBody.parentNode.replaceChild(temp.firstChild.firstChild, tableBody);
          temp.parentNode.removeChild(temp);
        }
        tableBody.innerHTML = aux;
        
        updateAll();
        updateTotal();

        if (document.frmMain.isFirstLoad.value=="true" && isTrue('isReceipt')) {
          document.frmMain.isFirstLoad.value="false";
          document.getElementById('paramActualPayment').value = document.getElementById('paramExpectedPayment').value;
          distributeAmount(document.getElementById('paramActualPayment').value);
        }
        
      } else {
        document.getElementById('sectionGrid').innerHTML = '';
      }
    } catch (e) {
    }
  }
  return true;
}

function loadFinancialAccountCombo() {
  try {
    var url = "../org.openbravo.advpaymentmngt.ad_actionbutton/AddPaymentFromInvoice.html";
    var paramXMLReq = null;
    return submitXmlHttpRequest(callBackFinancialAccount, document.frmMain, "FINANCIALACCOUNT", url, false, null, paramXMLReq);
  } catch (e) {
    alert(e);
  }
}

function reFillFinancialAccountCombo() {
  try {
    var url = "../org.openbravo.advpaymentmngt.ad_actionbutton/AddPaymentFromInvoice.html";
    var paramXMLReq = null;
    return submitXmlHttpRequest(callBackFinancialAccount, document.frmMain, "FILLFINANCIALACCOUNT", url, false, null, paramXMLReq);
  } catch (e) {
    alert(e);
  }
}

function loadPaymentMethodCombo() {
  try {
    var url = "../org.openbravo.advpaymentmngt.ad_actionbutton/AddPaymentFromInvoice.html";
    var paramXMLReq = null;
    return submitXmlHttpRequest(callBackPaymentMethod, document.frmMain, "PAYMENTMETHOD", url, false, null, paramXMLReq);
  } catch (e) {
    alert(e);
  }
}

function reFillPaymentMethodCombo() {
  try {
    var url = "../org.openbravo.advpaymentmngt.ad_actionbutton/AddPaymentFromInvoice.html";
    var paramXMLReq = null;
    return submitXmlHttpRequest(callBackPaymentMethod, document.frmMain, "FILLPAYMENTMETHOD", url, false, null, paramXMLReq);
  } catch (e) {
    alert(e);
  }
}

function callBackFinancialAccount(paramXMLParticular, XMLHttpRequestObj) {
  if (getReadyStateHandler(XMLHttpRequestObj)) {
    try {
      if (XMLHttpRequestObj.responseText) {
        var resp = decodeJSON(XMLHttpRequestObj.responseText);
        createCombo(document.getElementById('inpFinancialAccount'), resp.combo);
        document.getElementById('paramFinancialAccountCurrencyId').value = resp.financialAccountCurrencyId;
        document.getElementById('paramExchangeRate').value = resp.exchangeRate;
      } else {
        document.getElementById('inpFinancialAccount').innerHTML = '';
        document.getElementById('paramFinancialAccountCurrencyId').value = '';
        document.getElementById('paramExchangeRate').value = '';
      }
      displayMulticurrencyControls();
      updateConvertedAmounts();
    } catch (e) {
    }
  }
  return true;
}

function callBackPaymentMethod(paramXMLParticular, XMLHttpRequestObj) {
var strText = "";
  if (getReadyStateHandler(XMLHttpRequestObj)) {
    try {
      if (XMLHttpRequestObj.responseText) {
        strText = XMLHttpRequestObj.responseText;
        createCombo(document.getElementById('inpPaymentMethod'), strText);
      } else {
        document.getElementById('inpPaymentMethod').innerHTML = '';
      }
    } catch (e) {
    }
  }
  return true;
}

</script>
<script language="JavaScript" type="text/javascript">
  function onLoadDo(){
    this.windowTables = new Array(
      new windowTableId('client_top_popup', 'buttonOK'),
      new windowTableId('client_top', 'buttonProcess'),
      new windowTableId('client_middle', 'buttonProcess'),
      new windowTableId('client_botton', 'buttonProcess')
    );

    setWindowTableParentElement();
    enableShortcuts('popup');
    setBrowserAutoComplete(false);

    initFIN_Utilities(document.frmMain);

    try {
      onloadFunctions();
    } catch (e) {}
    displayLogicElement('sectionDifference', false);
    displayLogicElement('sectionDifferenceBox', false);
    processLabels();
    displayLogicElement('paramCustBalance', isTrue('isReceipt'));
    displayLogicElement('NoPackageslinkCalc', isTrue('isReceipt'));
    var hasCredit = compare(document.getElementById('paramCredit').value, '>', "0");
    displayLogicElement('paramCredit', hasCredit );
    displayLogicElement('paramUseCreditContainer', hasCredit );
    displayLogicElement('rowCredit', hasCredit );
    displayMulticurrencyControls();
    if (isTrue('isReceipt')) {
        setWindowElementFocus(frm.inpActualPayment);
    } else {
        document.getElementById('paramActualPayment').readOnly = true;
        document.getElementById('paramActualPayment').className = "readonly required dojoValidateValid TextBox_btn_OneCell_width number";
        setWindowElementFocus(frm.inpDocNumber);
    }
    loadGridList();
    resizeAreaCreateFrom();
  }

  function onResizeDo(){
    resizeAreaCreateFrom(true);
  }
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="onLoadDo();" onresize="onResizeDo();">
<form name="frmMain" method="post" action="AddPaymentFromInvoice.html">
  <input type="hidden" name="Command" />
  <input type="hidden" name="IsPopUpCall" value="1" />
  <input type="hidden" name="inpadOrgId" value="" id="fieldOrg"/>
  <input type="hidden" name="inpcInvoiceId" value="" id="fieldInvoice"/>
  <input type="hidden" name="inpadWindowId" value="" id="fieldWindowId"/>
  <input type="hidden" name="inpTabId" value="" id="fieldTabId"/>
  <input type="hidden" name="isReceipt" value="" id="fieldReceipt"/>
  <input type="hidden" name="isFirstLoad" value="true"/>
  <div class="Popup_ContentPane_CircleLogo">
    <div class="Popup_WindowLogo">
      <img class="Popup_WindowLogo_Icon Popup_WindowLogo_Icon_process" src="../../../../../web/images/blank.gif" border=0/></img>
    </div>
  </div>
  <table cellspacing="0" cellpadding="0" width="100%" id="table_header">
    <tr>
      <td>
        <table cellspacing="0" cellpadding="0" class="Popup_ContentPane_NavBar">
          <tr class="Popup_NavBar_bg"><td></td>
            <td class="Popup_NavBar_separator_cell"></td>
            <td class="Popup_NavBar_bg_logo_left"></td>
            <td class="Popup_NavBar_bg_logo" width="1" onclick="openNewBrowser('http://www.openbravo.com', 'Openbravo');return false;"><img src="../../../../../web/images/blank.gif" alt="Openbravo" title="Openbravo" border="0" id="openbravoLogo" class="Popup_NavBar_logo" /></td>
            <td class="Popup_NavBar_bg_logo_right"></td>
            <td class="Popup_NavBar_Popup_title_cell"><span name="lblR" id="lblRPopupTitle">Add Payment In</span><span name="lblP" id="lblPPopupTitle">Add Payment Out</span></td>
            <td class="Popup_NavBar_separator_cell"></td>
          </tr>
        </table>
      </td>
    </tr>

    <tr>
      <td>
        <table cellspacing="0" cellpadding="0" class="Popup_ContentPane_SeparatorBar">
          <tr>
            <td class="Popup_SeparatorBar_bg"></td>
          </tr>
        </table>
      </td>
    </tr>

  </table>
  <table cellspacing="0" cellpadding="0" width="100%">
    <tr>
      <td>
        <div class="Popup_ContentPane_Client" style="overflow: auto;" id="client_messagebox">

          <!-- MessageBox -->
          <table cellpadding="0" cellspacing="0" id="messageBoxID" class="MessageBoxyy">
            <tbody>
            <tr class="MessageBox_TopMargin">
              <td class="MessageBox_LeftMargin"></td>
              <td></td>
              <td class="MessageBox_RightMargin"></td>
            </tr>
            <tr>
              <td class="MessageBox_LeftMargin"></td>
              <td>

                <table cellpadding="0" cellspacing="0" class="MessageBox_Container">
                  <tbody>
                  <tr>
                    <td class="MessageBox_LeftTrans">
                      <table style="width: 100%; height: 100%" cellpadding="0" cellspacing="0">
                        <tbody>
                        <tr>
                          <td class="MessageBox_TopLeft"></td>
                        </tr>
                        <tr>
                          <td class="MessageBox_Left"></td>
                        </tr>
                        </tbody>
                      </table>
                    </td>
                    <td class="MessageBox_bg">

                      <table class="MessageBox_Top">
                      <tbody>
                        <tr>
                          <td>
                            <span>
                            <table cellpadding="0" cellspacing="0" class="MessageBox_Body_ContentCell">
                              <tbody>
                              <tr>
                                <td class="MessageBox_Icon_ContentCell">
                                  <div class="MessageBox_Icon"></div>
                                </td>
                                <td style="vertical-align: top;" id="messageBoxIDContent">
                                  <span>
                                    <div class="MessageBox_TextTitle" id="messageBoxIDTitle">
                                      xxInfo: AccessTableWithNoView
                                    </div>
                                    <div class="MessageBox_TextDescription" id="messageBoxIDMessage">
                                      xxThe current information is empty.
                                    </div>
                                    <div class="MessageBox_TextSeparator"></div>
                                  </span>
                                </td>
                              </tr>
                              </tbody>
                            </table>
                            </span>
                          </td>
                        </tr>
                        </tbody>
                      </table>

                    </td>
                    <td class="MessageBox_RightTrans">
                      <table style="width: 100%; height: 100%" cellpadding="0" cellspacing="0">
                        <tbody>
                        <tr>
                          <td class="MessageBox_TopRight"></td>
                        </tr>
                        <tr>
                          <td class="MessageBox_Right"></td>
                        </tr>
                        </tbody>
                      </table>
                    </td>
                  </tr>
                  <tr>
                    <td rowspan="2" class="MessageBox_BottomLeft">
                    </td>
                    <td class="MessageBox_BottomTrans MessageBox_bg">
                    </td>
                    <td rowspan="2" class="MessageBox_BottomRight">
                    </td>
                  </tr>
                  <tr>
                    <td class="MessageBox_Bottom">
                    </td>
                  </tr>
                  </tbody>
                </table>

              </td>
              <td class="MessageBox_RightMargin"></td>
            </tr>
            <tr class="MessageBox_BottomMargin">
              <td class="MessageBox_LeftMargin"></td>
              <td></td>
                <td class="MessageBox_RightMargin"></td>
              </tr>
            </tbody>
          </table>
        <!-- MessageBox END -->
        </div>
      </td>
    </tr>
  </table>

  <table cellspacing="0" cellpadding="0" width="100%">

    <tr>
      <td>
        <!-- Hidden Process Payment Div  -->
        <div class="Popup_ContentPane_Client" style="display: none;" id="client_top_popup">
          <table cellspacing="0" cellpadding="0" class="Popup_ContentPane_InfoBar">
           <tr>
             <td class="Popup_InfoBar_Icon_cell"><img src="../web/images/blank.gif" class="Popup_InfoBar_Icon_info" border="0"></td>
             <td class="Popup_InfoBar_text_table">
               <table>
                 <tr><td class="Popup_InfoBar_text" id="processHelp">Process Payment</td></tr>
                 </table>
              </td>
            </tr>
          </table>
          <table cellspacing="0" cellpadding="0" class="Popup_Client_TableSelector">
            <tr>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
            </tr>
            <tr><td colspan="6" height="20"></td></tr>
            <tr>
              <td class="TitleCell"></td>
              <td class="TitleCell" colspan="2"><span class="LabelText">Action regarding document</span></td>
              <td class="Combo_ContentCell">
                <select name="inpActionDocument" id="paramActionDocument" class="ComboKey Combo_TwoCells_width" required="true">
                  <div id="reportActionDocument"></div>
                </select>
              </td>
              <td class="TitleCell"></td>
              <td class="TitleCell"></td>
            </tr>
            <tr><td colspan="6" height="20"></td></tr>
            <tr>
              <td></td>
              <td></td>
              <td class="Button_RightAlign_ContentCell">
                <div>
                  <button type="button"
                    id="buttonOK"
                    class="ButtonLink_focus"
                    onclick="submitThisPage('SAVE');return false;"
                    onfocus="buttonEvent('onfocus', this); window.status='OK'; return true;"
                    onblur="buttonEvent('onblur', this);"
                    onkeyup="buttonEvent('onkeyup', this);"
                    onkeydown="buttonEvent('onkeydown', this);"
                    onkeypress="buttonEvent('onkeypress', this);"
                    onmouseup="buttonEvent('onmouseup', this);"
                    onmousedown="buttonEvent('onmousedown', this);"
                    onmouseover="buttonEvent('onmouseover', this); window.status='OK'; return true;"
                    onmouseout="buttonEvent('onmouseout', this);">
                    <table class="Button">
                      <tr>
                        <td class="Button_left"><img class="Button_Icon Button_Icon_ok" alt="OK" title="OK" src="../web/images/blank.gif" id="imgButtonOK" border="0"></td>
                        <td class="Button_text Button_width" id="tdButtonOK">OK</td>
                        <td class="Button_right"></td>
                      </tr>
                    </table>
                  </button>
                </div>
              </td>
              <td class="Button_LeftAlign_ContentCell">
                <div>
                  <button type="button"
                    id="buttonCancel"
                    class="ButtonLink"
                    onclick="closeProcessPayment();return false;"
                    onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;"
                    onblur="buttonEvent('onblur', this);"
                    onkeyup="buttonEvent('onkeyup', this);"
                    onkeydown="buttonEvent('onkeydown', this);"
                    onkeypress="buttonEvent('onkeypress', this);"
                    onmouseup="buttonEvent('onmouseup', this);"
                    onmousedown="buttonEvent('onmousedown', this);"
                    onmouseover="buttonEvent('onmouseover', this); window.status='Cancel'; return true;"
                    onmouseout="buttonEvent('onmouseout', this);">
                    <table class="Button">
                      <tr>
                        <td class="Button_left"><img class="Button_Icon Button_Icon_cancel" alt="Cancel" title="Cancel" src="../web/images/blank.gif" id="imgButtonCancel" border="0"></td>
                        <td class="Button_text Button_width" id="tdButtonCancel">Cancel</td>
                        <td class="Button_right"></td>
                      </tr>
                    </table>
                  </button>
                </div>
              </td>
              <td></td>
              <td></td>
            </tr>
          </table>
        </div>
        <div class="Popup_ContentPane_Client" style="overflow: auto;" id="client_top">
          <table cellspacing="0" cellpadding="0" class="Popup_Client_TableSelector">

            <tr>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
            </tr>

            <!-- Line 1 -->
            <tr>
              <td class="TitleCell"><span name="lblP" id="lblPDocNo" class="LabelText">Payment Out Document No.</span><span name="lblR" id="lblRDocNo" class="LabelText">Payment In Document No.</span></td>
              <td class="TextBox_ContentCell" colspan="2"><input class="dojoValidateValid required TextBox_TwoCells_width" type="text" name="inpDocNumber" value="" id="paramDocNumber"></input></td>
              <td class="TitleCell"><span class="LabelText" name="lblR" id="lblRCustomerBalance">Customer Balance</span></td>
              <td class="TextBox_ContentCell"><input class="readonly dojoValidateValid TextBox_OneCell_width number" type="text" name="inpCustBalance" value="" id="paramCustBalance"></input></td>
              <td class="TitleCell"></td>
            </tr>
            
            <!-- Line 2 -->
            <tr>
              <td class="TitleCell"><span class="LabelText" name="lblP" id="lblPToBePaidTo">To Be Paid To</span><span class="LabelText" name="lblR" id="lblRReceivedFrom">Received From</span></td>
              <td class="TextBox_ContentCell" colspan="2"><input class="readonly dojoValidateValid TextBox_TwoCells_width" type="text" name="inpBusinessPartner" value="" id="paramBusinessPartner" readonly="true"></input>
              <input type="hidden" name="inpBusinessPartnerId" value="" id="paramBusinessPartnerId"></input></td>
              <td class="TitleCell"><span class="LabelText">Reference No.</span></td>
              <td class="TextBox_ContentCell" colspan="2"><input class="dojoValidateValid TextBox_OneCell_width" type="text" name="inpReferenceNo" value="" id="paramReferenceNo"></input></td>
              <td class="TitleCell"></td>
            </tr>

            <!-- Line 3 (Hidden if no credit)-->
            <tr id="rowCredit">
              <td class="TitleCell"><span class="LabelText" name="lbl" id="lblCredit">Available Credit</span></td>
              <td class="TextBox_ContentCell"><input class="readonly dojoValidateValid TextBox_OneCell_width number" type="text" name="inpCredit" value="0" id="paramCredit"></input></td>
              <td class="TitleCell"></td>
              <td class="TitleCell"><span class="LabelText" name="lbl" id="lblUseCredit">Use Available Credit</span></td>
              <td class="Radio_Check_ContentCell"><span class="Checkbox_container_NOT_Focused" id="paramUseCreditContainer"><input type="checkbox" name="inpUseCredit" value="Y" id="paramUseCredit" onclick="useCreditOnChange();"></input></span></td>
              <td class="TitleCell"></td>
            </tr>
            
            <!-- Line 4 -->
            <tr>
              <td class="TitleCell"><span class="LabelText">Payment Method</span></td>
              <td class="Combo_ContentCell" colspan="2">
                <select name="inpPaymentMethod"
                        onkeypress="changeToEditingMode('onkeypress');"
                        onchange="changeToEditingMode('onchange', this);logChanges(this);loadFinancialAccountCombo(); reFillPaymentMethodCombo(); return true;"
                        class="ComboKey Combo_TwoCells_width" id="inpPaymentMethod">
                  <div id="sectionDetailPaymentMethod"></div>
                </select>
              </td>
              <td class="TitleCell"><span class="LabelText" name="lblP" id="lblPTakeFrom">Take From</span><span class="LabelText" name="lblR" id="lblRDepositTo">Deposit To</span></td>
              <td class="Combo_ContentCell" colspan="2">
                <input type="hidden" id="paramFinancialAccountCurrencyId" name="inpFinancialAccountCurrencyId" value=""/>
                <input type="hidden" id="paramFinancialAccountCurrencyPrecision" name="inpFinancialAccountCurrencyPrecision" value="2"/>

                <select name="inpFinancialAccount"
                        onkeypress="changeToEditingMode('onkeypress');"
                        onchange="changeToEditingMode('onchange', this);logChanges(this);loadPaymentMethodCombo(); reFillFinancialAccountCombo(); return true;"
                        class="ComboKey Combo_TwoCells_width" id="inpFinancialAccount">
                  <div id="sectionDetailFinancialAccount"></div>
                </select>
              </td>
            </tr>

            <!-- Line 5 -->
            <tr>
              <td class="TitleCell"><span class="LabelText">Invoice Currency</span></td>
              <td class="Combo_ContentCell">
                <select name="inpCurrencyId" id="paramCurrencyId" class="ComboKeyReadOnly Combo_OneCell_width" onchange="selectCombo(this, 'xx');return true;">
                    <option value=""><div id="reportC_Currency_ID"></div></option>
                </select>
              </td>
              <td class="TitleCell"></td>
              <td class="TitleCell"><span class="LabelText" id="lblExchangeRate">Exchange Rate</span></td>
              <td class="Textbox_ContentCell">
                <table style="border: 0px none; border-collapse: collapse;">
                  <tr><td style="padding-top: 0px;">
                    <input type="text" onblur="numberInputEvent('onblur', this);" onfocus="numberInputEvent('onfocus', this);" outputformat="generalQtyEdition" onchange="updateConvertedAmounts();return true;" onpaste="changeToEditingMode('onpaste');" oncut="changeToEditingMode('oncut');" onkeypress="changeToEditingMode('onkeypress');" onkeydown="changeToEditingMode('onkeydown'); numberInputEvent('onkeydown', this, event);" onkeyup="" name="inpExchangeRate" maxlength="22" value="" required="true" class="dojoValidateValid required TextBox_btn_OneCell_width number" id="paramExchangeRate"/>
                  </td></tr>
                </table>
                <span id="paramExchangeRateinvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
                  <table class="TextBox_MsgContainer_table">
                    <tbody><tr class="TextBox_MsgContainer_tr">
                      <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
                    </tr>
                    <tr>
                      <td class="invalid" colspan="2"><div name="invalidText" id="paramExchangeRateinvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td>
                    </tr>
                  </tbody></table>
                </span>
              </td>
              <td class="TitleCell"></td>
            </tr>
            
            <!-- Line 6 -->
            <tr>
              <td class="TitleCell"><span name="lblP" id="lblPExpectedPaym" class="LabelText">Expected Payment Out</span><span name="lblR" id="lblRExpectedPaym" class="LabelText">Expected Payment In</span></td>
              <td class="TextBox_ContentCell"> <input class="readonly dojoValidateValid required TextBox_OneCell_width number" type="text" id="paramExpectedPayment" name="inpExpectedPayment" value="" onchange="updateDifference();updateConvertedAmounts();" disabled="true"></input>
              </td>
              <td class="TitleCell"></td>
              <td class="TitleCell"><span class="LabelText" id="lblExpectedConverted">Expected Converted</span></td>
              <td class="TextBox_ContentCell"> <input class="readonly dojoValidateValid required TextBox_OneCell_width number" type="text" id="paramExpectedConverted" name="inpExpectedConverted" value="" onchange="" disabled="true"></input>
              </td>
              <td class="TitleCell"></td>
            </tr>
            
            <!-- Line 7 -->
            <tr>
              <td class="TitleCell"><span name="lblP" id="lblPActualPaym"class="LabelText">Actual Payment Out</span><span name="lblR" id="lblRActualPaym" class="LabelText">Actual Payment In</span></td>
              <td class="TextBox_btn_ContentCell">
                  <table border="0" cellspacing="0" cellpadding="0" summary=""  style="padding-top: 0px;">
                    <tr>
                      <td class="Textbox_ContentCell">
                      <table style="border: 0px none; border-collapse: collapse;">
                        <tr><td style="padding-top: 0px;">
                          <input type="text" onblur="numberInputEvent('onblur', this);" onfocus="numberInputEvent('onfocus', this);" outputformat="euroEdition" onchange="actualPaymentOnChange();updateConvertedAmounts();return true;" onpaste="changeToEditingMode('onpaste');" oncut="changeToEditingMode('oncut');" onkeypress="changeToEditingMode('onkeypress');" onkeydown="changeToEditingMode('onkeydown'); numberInputEvent('onkeydown', this, event);" onkeyup="" name="inpActualPayment" maxlength="22" value="" required="true" class="dojoValidateValid required TextBox_btn_OneCell_width number" id="paramActualPayment"/>
                        </td></tr>
                      </table>
                      <span id="paramActualPaymentinvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
                        <table class="TextBox_MsgContainer_table">
                          <tbody><tr class="TextBox_MsgContainer_tr">
                            <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
                          </tr>
                          <tr>
                            <td class="invalid" colspan="2"><div name="invalidText" id="paramActualPaymentinvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td>
                          </tr>
                        </tbody></table>
                      </span>
                      <span id="paramActualPaymentmissingSpan" style="display: none;" class="TextBox_MsgContainer_span">
                        <table class="TextBox_MsgContainer_table">
                          <tbody><tr class="TextBox_MsgContainer_tr">
                            <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
                          </tr>
                          <tr>
                            <td class="missing" colspan="2"><div name="missingText" id="paramActualPaymentmissingSpanText" class="TextBox_MsgContainer_div2">* This value is required.</div></td>
                          </tr>
                          </tbody></table>
                      </span>
                      </td>
                      <td class="FieldButton_ContentCell">
                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Amount From'; return true;" onblur=" window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;"  onclick="calculator('frmMain.inpActualPayment', document.frmMain.inpActualPayment.value, false);return false;">
                      <table class="FieldButton" onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;" id="NoPackageslinkCalc">
                          <tr>
                            <td class="FieldButton_bg">
                              <img alt="Calculator" class="FieldButton_Icon FieldButton_Icon_Calc" title="Amount" src="../../../../../web/images/blank.gif" border="0" id="buttonCalc"></img>
                            </td>
                          </tr>
                        </table>
                      </a>
                      </td>
                    </tr>
                  </table>
              </td>
              <td class="TitleCell"></td>
              <td class="TitleCell"><span class="LabelText" id="lblActualConverted">Actual Converted</span></td>
              <td class="TextBox_btn_ContentCell">
                  <table border="0" cellspacing="0" cellpadding="0" summary=""  style="padding-top: 0px;" id="paramActualConvertedCell">
                    <tr>
                      <td class="Textbox_ContentCell">
                      <table style="border: 0px none; border-collapse: collapse;">
                        <tr><td style="padding-top: 0px;">
                          <input type="text" onblur="numberInputEvent('onblur', this);" onfocus="numberInputEvent('onfocus', this);" outputformat="euroEdition" onchange="updateConvertedAmounts(true);return true;" onpaste="changeToEditingMode('onpaste');" oncut="changeToEditingMode('oncut');" onkeypress="changeToEditingMode('onkeypress');" onkeydown="changeToEditingMode('onkeydown'); numberInputEvent('onkeydown', this, event);" onkeyup="" name="inpActualConverted" maxlength="22" value="" required="true" class="dojoValidateValid required TextBox_btn_OneCell_width number" id="paramActualConverted"/>
                        </td></tr>
                      </table>
                      <span id="paramActualConvertedinvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
                        <table class="TextBox_MsgContainer_table">
                          <tbody><tr class="TextBox_MsgContainer_tr">
                            <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
                          </tr>
                          <tr>
                            <td class="invalid" colspan="2"><div name="invalidText" id="paramActualConvertedinvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td>
                          </tr>
                        </tbody></table>
                      </span>
                      </td>
                      <td class="FieldButton_ContentCell">
                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Amount From'; return true;" onblur=" window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;"  onclick="calculator('frmMain.inpActualConverted', document.frmMain.inpActualConverted.value, false);return false;">
                      <table class="FieldButton" onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;" id="NoPackageslinkCalc">
                          <tr>
                            <td class="FieldButton_bg">
                              <img alt="Calculator" class="FieldButton_Icon FieldButton_Icon_Calc" title="Amount" src="../../../../../web/images/blank.gif" border="0" id="buttonCalc"></img>
                            </td>
                          </tr>
                        </table>
                      </a>
                      </td>
                    </tr>
                  </table>
              </td>
              <td class="TitleCell"></td>
            </tr>
            
            <!-- Line 8 -->
            <tr>
              <td class="TitleCell"><span name="lblP" id="lblPPaymDate" class="LabelText">Payment Out Date</span><span name="lblR" id="lblRPaymDate"class="LabelText">Payment In Date</span></td>
              <td class="TextBox_btn_ContentCell">
                <table border="0" cellspacing="0" cellpadding="0" summary=""  style="padding-top: 0px;">
                  <tr>
                    <td class="TextBox_ContentCell">
                      <table style="border: 0px none; border-collapse: collapse;">
                        <tr><td style="padding-top: 0px;">
                          <input type="text" id="paramPaymentDate" name="inpPaymentDate" onchange="validateDateTextBox(this.id); validateDate(this);paymentDateOnChange(this);logChanges(this);return true;" onblur="expandDateYear(this.id);" oncontextmenu="changeToEditingMode('oncontextmenu');" onpaste="changeToEditingMode('onpaste');" oncut="changeToEditingMode('oncut');" onkeypress="changeToEditingMode('onkeypress');" onkeydown="changeToEditingMode('onkeydown');" onkeyup="autoCompleteDate(this);" maxlength="10" value="" required="true" class="dojoValidateValid required TextBox_btn_OneCell_width" displayFormat="xx" saveFormat="yy">
                        </td></tr>
                      </table>
                      <span id="paramPaymentDateinvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
                        <table class="TextBox_MsgContainer_table">
                          <tbody><tr class="TextBox_MsgContainer_tr"><td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td></tr>
                          <tr><td class="invalid" colspan="2"><div name="invalidText" id="paramPaymentDateinvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td></tr>
                        </tbody></table>
                      </span>
                      <span id="paramPaymentDatemissingSpan" style="display: none;" class="TextBox_MsgContainer_span">
                        <table class="TextBox_MsgContainer_table">
                          <tbody><tr class="TextBox_MsgContainer_tr">
                            <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
                          </tr>
                          <tr>
                            <td class="missing" colspan="2"><div name="missingText" id="paramPaymentDatemissingSpanText" class="TextBox_MsgContainer_div2">* This value is required.</div></td>
                          </tr>
                          </tbody></table>
                      </span>
                    </td>
                    <td class="FieldButton_ContentCell">
                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Calendar'; return true;" onblur="window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;" onclick="showCalendar('frmMain.inpPaymentDate', document.frmMain.inpPaymentDate.value, false);return false;">
                        <table class="FieldButton"  onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='Show calendar';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;">
                          <tr>
                            <td class="FieldButton_bg">
                              <img alt="Calendar" class="FieldButton_Icon FieldButton_Icon_Calendar" title="Calendar" src="../../../../../web/images/blank.gif" border="0"></img>
                            </td>
                          </tr>
                        </table>
                      </a>
                    </td>
                  </tr>
                </table>
              </td>
              <td class="TitleCell"></td>
              <td class="TitleCell"></td>
              <td class="TitleCell"></td>
            </tr>
            
            <!-- Text -->
            <tr>
                <td colspan="6" class="LabelText" style="font-weight: bold;">
                    <span name="lblP" id="lblPText">Select additional purchase invoices or purchase orders that you want to add to this payment out</span>
                    <span name="lblR" id="lblRText">Select additional sales invoices or sales orders that you want to add to this payment in</span>
                </td>
            </tr>
            
            <tr class="FieldGroup_BottomMargin"></tr>
            
            <!-- Table filters -->
            <tr> 
             <td class="TitleCell"><span class="LabelText">Transaction Type</span></td>
             <td class="Combo_ContentCell">
               <select name="inpDocumentType" class="ComboKey Combo_OneCell_width" onchange="loadGridList();">
                 <option value="O">Orders</option>
                 <option value="I" selected="selected">Invoices</option>
                 <option value="B">Orders and Invoices</option>
               </select>
             </td>
             <td></td>
             <td class="TitleCell"><span class="LabelText">Due Date From</span></td>
             <td class="TextBox_btn_ContentCell">
                <table border="0" cellspacing="0" cellpadding="0" summary=""  style="padding-top: 0px;">
                  <tr>
                    <td class="TextBox_ContentCell">
                    <table style="border: 0px none; border-collapse: collapse;">
                        <tr><td style="padding-top: 0px;">
                          <input type="text" id="paramDueDateFrom" class="dojoValidateValid TextBox_btn_OneCell_width" value="" maxlength="10" name="inpDueDateFrom" onkeyup="autoCompleteDate(this);" onkeydown="changeToEditingMode('onkeydown');" onkeypress="changeToEditingMode('onkeypress');" oncut="changeToEditingMode('oncut');" onpaste="changeToEditingMode('onpaste');" oncontextmenu="changeToEditingMode('oncontextmenu');" onblur="expandDateYear(this.id);" onchange="validateDateTextBox(this.id); validateDate(this);return true;" displayFormat="xx" saveFormat="yy"></input>
                        </td></tr>
                      </table>
                      <span id="paramDueDateFrominvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
                        <table class="TextBox_MsgContainer_table">
                          <tbody><tr class="TextBox_MsgContainer_tr"><td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td></tr>
                          <tr><td class="invalid" colspan="2"><div name="invalidText" id="paramDueDateFrominvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td></tr>
                        </tbody></table>
                      </span>
                    </td>
                    <td class="FieldButton_ContentCell">
                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Calendar'; return true;" onblur="window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;" onclick="showCalendar('frmMain.inpDueDateFrom', document.frmMain.inpDueDateFrom.value, false);return false;">
                        <table class="FieldButton" onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='Show calendar';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;">
                          <tr>
                            <td class="FieldButton_bg">
                              <img alt="Calendar" class="FieldButton_Icon FieldButton_Icon_Calendar" title="Calendar" src="../../../../../web/images/blank.gif" border="0"></img>
                            </td>
                          </tr>
                        </table>
                      </a>
                    </td>
                  </tr>
                </table>
              </td>
             </tr>
             
             <tr>
              <td class="TitleCell" ><span name="lblP" id="lblPShowAlternative" class="TitleCell LabelText"><label for="paramAlternativePaymentMethod">Show payments out for alternative payment methods</label></span>
                                     <span name="lblR" id="lblRShowAlternative" class="TitleCell LabelText"><label for="paramAlternativePaymentMethod">Show payments in for alternative payment methods</label></span></td>
              <td class="Radio_Check_ContentCell">
                <span class="Radio_Check_ContentCell Checkbox_container_NOT_Focused"><input type="checkbox" name="inpAlternativePaymentMethod" value="Y" id="paramAlternativePaymentMethod" onclick="loadGridList()"></input></span>                
              </td>
              <td></td>
              <td class="TitleCell"><span class="LabelText">Due Date To</span></td>
              <td class="TextBox_btn_ContentCell">
                <table border="0" cellspacing="0" cellpadding="0" summary=""  style="padding-top: 0px;">
                  <tr>
                    <td class="TextBox_ContentCell">
                     <table style="border: 0px none; border-collapse: collapse;">
                         <tr><td style="padding-top: 0px;">
                           <input type="text" id="paramDueDateTo" class="dojoValidateValid TextBox_btn_OneCell_width" value="" maxlength="10" name="inpDueDateTo" onkeyup="autoCompleteDate(this);" onkeydown="changeToEditingMode('onkeydown');" onkeypress="changeToEditingMode('onkeypress');" oncut="changeToEditingMode('oncut');" onpaste="changeToEditingMode('onpaste');" oncontextmenu="changeToEditingMode('oncontextmenu');" onblur="expandDateYear(this.id);" onchange="validateDateTextBox(this.id); validateDate(this);return true;" displayFormat="xx" saveFormat="yy"></input>
                         </td></tr>
                       </table>
                       <span id="paramDueDateToinvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
                         <table class="TextBox_MsgContainer_table">
                           <tbody><tr class="TextBox_MsgContainer_tr"><td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td></tr>
                           <tr><td class="invalid" colspan="2"><div name="invalidText" id="paramDueDateToinvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td></tr>
                         </tbody></table>
                       </span>
                    </td>
                    <td class="FieldButton_ContentCell">
                       <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Calendar'; return true;" onblur="window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;" onclick="showCalendar('frmMain.inpDueDateTo', document.frmMain.inpDueDateTo.value, false);return false;">
                         <table class="FieldButton" onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='Show calendar';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;">
                           <tr>
                             <td class="FieldButton_bg">
                               <img alt="Calendar" class="FieldButton_Icon FieldButton_Icon_Calendar" title="Calendar" src="../../../../../web/images/blank.gif" border="0"></img>
                             </td>
                           </tr>
                         </table>
                       </a>
                    </td>
                  </tr>
                </table>
              </td>
             </tr>
            <tr class="FieldGroup_BottomMargin"></tr>
          </table>
        </div>
      </td>
    </tr>
    <tr>
      <td>
        <div class="Popup_ContentPane_Client" style="overflow: auto;" id="client_middle">
          <table height="100%" border="0" cellpadding="0" cellspacing="0" id="main">
            <tr>
              <td valign="top" class="Popup_Client_Selector_DataGrid_LeftMargin">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" id="tdleftSeparator">
                  <tr><td class="Popup_Client_Selector_DataGrid_LeftMargin"></td></tr>
                </table>
              </td>
              <td valign="top">
                <div id="client2" style="overflow: auto;">
                  <table cellspacing="0" cellpadding="0" width="100%" class="DataGrid_Header_Table DataGrid_Body_Table" style="table-layout: auto;">
                    <thead>
                      <tr class="DataGrid_Body_Row">
                        <th class="DataGrid_Header_LineNoCell DataGrid_Body_Cell_CheckBox" width="25"> 
                          <input type="checkbox" name="inpAllLines" onclick="markAll(document.frmMain.inpScheduledPaymentDetailId, this.checked);updateAll(true);return true;"/>
                        </th>
                        <th class="DataGrid_Header_Cell" width="120"><span name="lblP" id="lblPPON">Purchase Order No.</span><span name="lblR" id="lblRSON">Sales Order No.</span></th>
                        <th class="DataGrid_Header_Cell" width="120"><span name="lblP" id="lblPPIN">Purchase Invoice No.</span><span name="lblR" id="lblRSIN">Sales Invoice No.</span></th>
                        <th class="DataGrid_Header_Cell" width="100">Payment Method</th>
                        <th class="DataGrid_Header_Cell" width="70">Due Date</th>
                        <th class="DataGrid_Header_Cell DataGrid_Header_Cell_Inverse" width="100">Invoiced Amount</th>
                        <th class="DataGrid_Header_Cell DataGrid_Header_Cell_Inverse" width="100">Expected Amount</th>
                        <th class="DataGrid_Header_Cell DataGrid_Header_Cell_Inverse" width="100">Outstanding Amount</th>
                        <th class="DataGrid_Header_Cell DataGrid_Header_Cell_Inverse" width="110"><span name="lblP" id="lblPPayment">Payment Out</span><span name="lblR" id="lblRPayment">Payment In</span></th>
                      </tr>
                    </thead>
                    <tbody id="sectionGrid">
                    </tbody>
                  </table>
                  <input type="hidden" id="inpTotal" value="" outputformat="euroEdition"/>
                  <input type="hidden" name="inpDifference" id="inpDifference" value="" outputformat="euroEdition"/>
                  <table cellspacing="0" cellpadding="0" width="100%" class="" style="table-layout: auto;">
                    <tr class="FieldGroup_BottomMargin"></tr>
                    <tr>
                      <td width="715" class="LabelText" style="text-align:right">Total</td>
                      <td class="LabelText number" style="padding-right:10px;font-weight: bold;"><span id="paramTotal"></span></td>
                    </tr>
                    <tr id="sectionDifference">
                      <td class="LabelText" style="text-align:right">There is a difference of</td>
                      <td class="LabelText number" style="padding-right:10px;font-weight: bold;"><span id="paramDifference"></span></td>
                    </tr>
                    <tr id="sectionDifferenceBox">
                      <td></td>
                      <td>
                        <table cellspacing="0" cellpadding="0" width="100%" class="" style="border: #888888 2px solid; table-layout: auto;">
                          <tr id="underpayment">
                            <td class="Radio_Check_ContentCell" width="20">
                              <input type="radio" name="inpDifferenceAction" value="underpayment" checked="checked"/>
                            </td>
                            <td><span class="LabelText">Leave this as an underpayment</span></td>
                          </tr>
                          <tr id="credit">
                            <td class="Radio_Check_ContentCell" width="20">
                              <input type="radio" name="inpDifferenceAction" value="credit"/>
                            </td>
                            <td><span class="LabelText">Leave the credit to be used later</span></td>
                          </tr>
                          <tr id="refund">
                            <td class="Radio_Check_ContentCell" width="20">
                              <input type="radio" name="inpDifferenceAction" value="refund"/>
                            </td>
                            <td><span class="LabelText">Refund amount to customer</span></td>
                          </tr>
                          <tr id="writeoff">
                            <td class="Radio_Check_ContentCell">
                              <input type="radio" name="inpDifferenceAction" value="writeoff"/>
                            </td>
                            <td><span class="LabelText">Write off the difference</span></td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </div>
              </td>
              <td valign="top" class="Popup_Client_Selector_DataGrid_RightMargin">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" id="tdrightSeparator">
                  <tr><td class="Popup_Client_Selector_DataGrid_RightMargin"></td></tr>
                </table>
              </td>
            </tr>
            
          </table>
        </div>
      </td>
    </tr>
    
    <tr>
      <td>
        <div class="Popup_ContentPane_Client" style="overflow: auto; padding-bottom: 5px;" id="client_bottom">
          <table cellspacing="0" cellpadding="0" class="Popup_Client_TableSelector">

            <tr>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
              <td class="TableEdition_OneCell_width"></td>
            </tr>
            <tr>
              <td></td>
              <td></td>
              <td class="Button_RightAlign_ContentCell">
                <div>
                  <button type="button" 
                    id="buttonProcess"
                    class="ButtonLink" 
                    onclick="openProcessPayment();return false;"
                    onfocus="buttonEvent('onfocus', this); window.status='Create'; return true;"
                    onblur="buttonEvent('onblur', this);"
                    onkeyup="buttonEvent('onkeyup', this);"
                    onkeydown="buttonEvent('onkeydown', this);"
                    onkeypress="buttonEvent('onkeypress', this);"
                    onmouseup="buttonEvent('onmouseup', this);"
                    onmousedown="buttonEvent('onmousedown', this);"
                    onmouseover="buttonEvent('onmouseover', this); window.status='Create'; return true;"
                    onmouseout="buttonEvent('onmouseout', this);">
                    <table class="Button">
                      <tr>
                        <td class="Button_left"><img class="Button_Icon Button_Icon_ok" alt="Process" title="Process" src="../../../../../web/images/blank.gif" border="0" /></td>
                        <td class="Button_text Button_width">Process</td>
                        <td class="Button_right"></td>
                      </tr>
                    </table>
                  </button>
                </div>
              </td>
              <td class="Button_LeftAlign_ContentCell">
                <div>
                  <button type="button" 
                    id="buttonCancel" 
                    class="ButtonLink" 
                    onclick="closeThisPage();return false;"
                    onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;"
                    onblur="buttonEvent('onblur', this);"
                    onkeyup="buttonEvent('onkeyup', this);"
                    onkeydown="buttonEvent('onkeydown', this);"
                    onkeypress="buttonEvent('onkeypress', this);"
                    onmouseup="buttonEvent('onmouseup', this);"
                    onmousedown="buttonEvent('onmousedown', this);"
                    onmouseover="buttonEvent('onmouseover', this); window.status='Cancel'; return true;"
                    onmouseout="buttonEvent('onmouseout', this);">
                    <table class="Button">
                      <tr>
                        <td class="Button_left"><img class="Button_Icon Button_Icon_cancel" alt="Cancel" title="Cancel" src="../../../../../web/images/blank.gif" border="0" /></td>
                        <td class="Button_text Button_width">Cancel</td>
                        <td class="Button_right"></td>
                      </tr>
                    </table>
                  </button>
                </div>
              </td>
              <td></td>
              <td></td>
            </tr>
          </table>
        </div>
      </td>
    </tr>
  </table>
</form>
</body>
</html>
